import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class test01
{

	public static void main(String[] args)
	{
		//检查字符串是否符合规则pattern
		String str = "asfxx&&1234++ert";
		
		//表达式对象
		Pattern pattern = Pattern.compile("\\w+");
		
		//创建MATCHER对象
		Matcher matcher = pattern.matcher(str);
		
//		//matches是将整个区域与之匹配
//		boolean result = matcher.matches();
//		System.out.println(result);
//		
		//find查找与规则相匹配的子序列，
//		System.out.println(matcher.find());
//		System.out.println(matcher.group());
//		
//		System.out.println(matcher.find());
//		System.out.println(matcher.group());

		
		while(matcher.find())
		{
			System.out.println(matcher.group());
		}
	}

}
